﻿using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using GameStudio.Common;
using GameStudio.IDE.Common.Events;
using Utils.EventAggregator;
using GameStudio.IDE.Common;
using System.IO;
using System.Windows.Forms;
using System.Windows.Forms.Integration;

namespace GameStudio.IDE.Controls
{
   // [TemplatePart(Name = "host", Type = typeof(WindowsFormsHost))]
    [TemplatePart(Name = "grid1", Type = typeof(Grid))]


    public class CodeEditorControl : System.Windows.Controls.Control
    {
        //WindowsFormsHost host;
        Grid grid1;

        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            grid1 = (Grid)GetTemplateChild("grid1");

            System.Windows.Forms.Integration.WindowsFormsHost host =
        new System.Windows.Forms.Integration.WindowsFormsHost();

            ScintillaNet.Scintilla codeEditor = new ScintillaNet.Scintilla();
            codeEditor.ConfigurationManager.Language = "cs";
            codeEditor.Margins[0].Width = 20;

            // Assign the MaskedTextBox control as the host control's child.
            //  host.Child = mtbDate;
            host.Child = codeEditor;

            // Add the interop host control to the Grid
            // control's collection of child controls.
            grid1.Children.Add(host);
        }

    }
}
